<?php

/**
 * This is the model class for table "{{question_sum}}".
 *
 * The followings are the available columns in table '{{question_sum}}':
 * @property double $id
 * @property double $exam_id
 * @property double $subject_id
 * @property string $collect_fields
 * @property double $collect_mode
 * @property string $collect_questions
 * @property string $collect_question
 * @property double $create_user
 * @property double $create_time
 * @property double $update_user
 * @property double $update_time
 */
class QuestionSum extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return QuestionSum the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{question_sum}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('exam_id, subject_id, collect_mode, create_user, create_time, update_user, update_time,no_statis_unline,dot_num', 'numerical'),
			array('collect_fields', 'length', 'max'=>50),
			array('collect_question, collect_questions', 'length', 'max'=>3000),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, exam_id, subject_id, collect_fields, collect_mode, collect_questions, collect_question, create_user, create_time, update_user, update_time,update_time,no_statis_unline,dot_num', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'exam_id' => 'Exam',
			'subject_id' => 'Subject',
			'collect_fields' => 'Collect Fields',
			'collect_mode' => 'Collect Mode',
			'collect_questions' => 'Collect Questions',
			'collect_question' => 'Collect Question',
            'no_statis_unline' => 'no_statis_unline',
            'dot_num' => 'dot_num',
			'create_user' => 'Create User',
			'create_time' => 'Create Time',
			'update_user' => 'Update User',
			'update_time' => 'Update Time',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('exam_id',$this->exam_id);
		$criteria->compare('subject_id',$this->subject_id);
		$criteria->compare('collect_fields',$this->collect_fields,true);
		$criteria->compare('collect_mode',$this->collect_mode);
		$criteria->compare('collect_questions',$this->collect_questions,true);
		$criteria->compare('collect_question',$this->collect_question,true);
		$criteria->compare('create_user',$this->create_user);
		$criteria->compare('create_time',$this->create_time);
		$criteria->compare('update_user',$this->update_user);
		$criteria->compare('update_time',$this->update_time);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}